// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 

package com.nnee.p_img.p_video;

import android.graphics.*;
import android.media.FaceDetector;
import android.os.Handler;

// Referenced classes of package com.nnee.p_img.p_video:
//            ao, cls_ActivityCropImage, CropImageView, b

class cls_h
    implements Runnable
{

	cls_h(cls_ActivityCropImage cls_ActivityCropImage)
    {
		super();
        e = cls_ActivityCropImage;
        
        a = 1F;
        c = new android.media.FaceDetector.Face[3];
    }

    private void a()
    {
        cls_ao ao1 = new cls_ao(cls_ActivityCropImage.c(e));
        int i = cls_ActivityCropImage.b(e).getWidth();
        int j = cls_ActivityCropImage.b(e).getHeight();
        Rect rect = new Rect(0, 0, i, j);
        int k = (i - 152) / 2;
        int l = (j - 152) / 2;
        RectF rectf = new RectF(k, l, k + 152, l + 152);
        ao1.a(b, rect, rectf, cls_ActivityCropImage.e(e));
        cls_ActivityCropImage.c(e).a(ao1);
    }

    private void a(android.media.FaceDetector.Face face)
    {
        PointF pointf = new PointF();
        int i = 2 * (int)(face.eyesDistance() * a);
        face.getMidPoint(pointf);
        pointf.x = pointf.x * a;
        pointf.y = pointf.y * a;
        int j = (int)pointf.x;
        int k = (int)pointf.y;
        cls_ao ao1 = new cls_ao(cls_ActivityCropImage.c(e));
        int l = cls_ActivityCropImage.b(e).getWidth();
        int i1 = cls_ActivityCropImage.b(e).getHeight();
        Rect rect = new Rect(0, 0, l, i1);
        int j1 = (l - 152) / 2;
        int k1 = (i1 - 152) / 2;
        RectF rectf = new RectF(j1, k1, j1 + 152, k1 + 152);
        ao1.a(b, rect, rectf, cls_ActivityCropImage.e(e));
        RectF rectf1 = new RectF(j, k, j, k);
        rectf1.inset(-i, -i);
        if(rectf1.left < 0F)
            rectf1.inset(-rectf1.left, -rectf1.left);
        if(rectf1.top < 0F)
            rectf1.inset(-rectf1.top, -rectf1.top);
        if(rectf1.right > (float)rect.right)
            rectf1.inset(rectf1.right - (float)rect.right, rectf1.right - (float)rect.right);
        if(rectf1.bottom > (float)rect.bottom)
            rectf1.inset(rectf1.bottom - (float)rect.bottom, rectf1.bottom - (float)rect.bottom);
        ao1.a(b, rect, rectf1, false);
        cls_ActivityCropImage.c(e).a(ao1);
    }

    static void a(cls_h h1)
    {
        h1.a();
    }

    private Bitmap b()
    {
        Bitmap bitmap;
        if(cls_ActivityCropImage.b(e) == null)
        {
            bitmap = null;
        } else
        {
            if(cls_ActivityCropImage.b(e).getWidth() > 256)
                a = 256F / (float)cls_ActivityCropImage.b(e).getWidth();
            Matrix matrix = new Matrix();
            matrix.setScale(a, a);
            bitmap = Bitmap.createBitmap(cls_ActivityCropImage.b(e), 0, 0, cls_ActivityCropImage.b(e).getWidth(), cls_ActivityCropImage.b(e).getHeight(), matrix, true);
        }
        return bitmap;
    }

    public void run()
    {
        b = cls_ActivityCropImage.c(e).getImageMatrix();
        Bitmap bitmap = b();
        a = 1F / a;
        if(bitmap != null)
            d = (new FaceDetector(bitmap.getWidth(), bitmap.getHeight(), c.length)).findFaces(bitmap, c);
        if(bitmap != null && bitmap != cls_ActivityCropImage.b(e))
            bitmap.recycle();
        cls_ActivityCropImage.d(e).post(new cls_b(this));
    }

    float a;
    Matrix b;
    android.media.FaceDetector.Face c[];
    int d;
    final cls_ActivityCropImage e;
}
